package com.example.campus;

import java.util.ArrayList;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
public class ViewPagerAdapter extends PagerAdapter {

	public String[]tab;
	Context context;
	public ViewPagerAdapter(String[]tab,Context context)
	{
		this.tab=tab;
		this.context=context;
	}
	
	
	
		
		@Override
		public int getCount() {
			return tab.length;
		}

	
		@Override
		public boolean isViewFromObject(View arg0, Object arg1) {
			return arg0 == arg1;
		}

		@Override
		public void destroyItem(ViewGroup view, int position, Object object) {
			view.removeView((View) object);
		}

		
		@Override
		public Object instantiateItem(ViewGroup view, int position) {
			
			NewsListView news=new NewsListView(position,context);
			news.init();
			view.addView(news.getView());
			return  news.getView();
		}
}
	